// JavaScript Document

addEvent(window, 'load', editions);
addEvent(window, 'load', holdings);

// variable oclc  set in xslt

function editions()
{
	$('editions-loading').update('Loading . . . ');
	url = "./?action=editions&oclc=" + oclc;
	new Ajax.Updater('editions', url, { method: 'get' });
}

function holdings()
{
	$('holdings-loading').update('Loading . . . ');
	url = "./?action=holdings&oclc=" + oclc;
	new Ajax.Updater('holdings', url, { method: 'get' });
}

function lookup(a)
{
	var arrID = a.id.split(/_/);
	var library = arrID[1];

	url = a.href;
	
	$('lookup_' + library).update('Loading . . . ');
	
	new Ajax.Updater('lookup_' + library, url, { method: 'get' });
}

function addEvent(obj, evType, fn)
{ 
	if (obj.addEventListener)
	{ 
		obj.addEventListener(evType, fn, false); 
		return true; 
	} 
	else if (obj.attachEvent)
	{ 
		var r = obj.attachEvent("on"+evType, fn); 
		return r; 
	} 
	else
	{ 
		return false; 
	} 
}

